var totalTimeR = 0.0;
private var textMeshComponent;


// store the text component so that GetComponent isn't called every frame

function Start() {

	textMeshComponent = GetComponent("TextMesh");
}

// update is called every frame
function Update() {

	// add amount of time since last frame to the totalTime
	totalTimeR -= Time.deltaTime;
	
	// use substring to get a shorter numerical value
	textMeshComponent.text = totalTimeR.ToString().Substring(0,3);

	//check totalTime to see if it has reached 0 and then load main menu
	if(totalTimeR > 0)
	{
		totalTimeR -= Time.deltaTime;
	}
	
	if(totalTimeR <= 0){
		Application.LoadLevel(3);
		totalTimeR = 0.0;
	}

}